package zhr.chapter7;

public class Example7_3 {
    public static void main(String[] args) {
        String s = "Java是一个高效的面向对象语言，我喜欢Java，我在学习Java";
        int count = 0, start = 0;
        while (start < s.length() - 3) {
            if (s.regionMatches(true, start, "Java", 0, 4)) {
                count++;
            }
            start++;
        }
        System.out.println("统计结果为count = " + count);
    }
}
